package tt.dz.biz.dao.account;

import java.util.List;
import org.springframework.stereotype.Repository;
import tt.dz.biz.dao.BaseDAO;
import tt.dz.vo.AssetsLbltsAccountRuleVO;

@Repository("assetsLbltsAccountRuleDAO")
public class AssetsLbltsAccountRuleDAO
  extends BaseDAO
{
  private static final String LIST_ALL_ASSETSLBLTSACCOUNTRULE = "select * from ms_assets_lblts_account_rule;";
  private static final String INSERT_ASSETSLBLTSACCOUNTRULE = "insert into ms_assets_lblts_account_rule(rule_seq,service_no,subject_code,sub_subject_code,cprt_bal_type,loan_flag,balance_flag,created_by,created_time,updated_by,updated_time,is_valid)  values(:ruleSeq,:serviceNo,:subjectCode,:subSubjectCode,:cprtBalType,:loanFlag,:balanceFlag,:createdBy,:createdTime,:updatedBy,:updatedTime,:isValid )";
  private static final String UPDATE_ASSETSLBLTSACCOUNTRULE = "update  ms_assets_lblts_account_rule set service_no = :serviceNo,subject_code = :subjectCode,sub_subject_code = :subSubjectCode,cprt_bal_type=:cprtBalType,loan_flag = :loanFlag,balance_flag=:balanceFlag,created_by = :createdBy,created_time = :createdTime,updated_by = :updatedBy,updated_time = :updatedTime,is_valid = :isValid where rule_seq = :ruleSeq";
  
  public List<AssetsLbltsAccountRuleVO> listAllAssetsLbltsAccountRule()
  {
    return queryForList("select * from ms_assets_lblts_account_rule;", null, AssetsLbltsAccountRuleVO.class);
  }
  
  public int insertAssetsLbltsAccountRule(AssetsLbltsAccountRuleVO assetsLbltsAccountRuleVO)
  {
    assetsLbltsAccountRuleVO.setRuleSeq(querySequence());
    return save("insert into ms_assets_lblts_account_rule(rule_seq,service_no,subject_code,sub_subject_code,cprt_bal_type,loan_flag,balance_flag,created_by,created_time,updated_by,updated_time,is_valid)  values(:ruleSeq,:serviceNo,:subjectCode,:subSubjectCode,:cprtBalType,:loanFlag,:balanceFlag,:createdBy,:createdTime,:updatedBy,:updatedTime,:isValid )", assetsLbltsAccountRuleVO);
  }
  
  public int updateAssetsLbltsAccountRule(AssetsLbltsAccountRuleVO assetsLbltsAccountRuleVO)
  {
    return save("update  ms_assets_lblts_account_rule set service_no = :serviceNo,subject_code = :subjectCode,sub_subject_code = :subSubjectCode,cprt_bal_type=:cprtBalType,loan_flag = :loanFlag,balance_flag=:balanceFlag,created_by = :createdBy,created_time = :createdTime,updated_by = :updatedBy,updated_time = :updatedTime,is_valid = :isValid where rule_seq = :ruleSeq", assetsLbltsAccountRuleVO);
  }
}
